<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui"
                template="../templates/ui.xhtml">

    <ui:define name="content">
        <h1 class="title ui-widget-header ui-corner-all">Confirm Dialog</h1>
        <div class="entry">
            <p>ConfirmDialog is integrated with confirm behavior and used as a replacement for the javascript confirmation utility.</p>

            <h:form>

                <p:growl id="messages" showDetail="true" />

                <p:commandButton value="Destroy the World" actionListener="#{buttonBean.destroyWorld}" update="messages">
                    <p:confirm header="Confirmation" message="Are you sure?" icon="ui-icon-alert"/>
                </p:commandButton>

                <p:confirmDialog global="true" showEffect="fade" hideEffect="explode">
                    <p:commandButton value="Yes" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check"/>
                    <p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close"/> 	
                </p:confirmDialog>

            </h:form>

            <h3>Source</h3>
            <p:tabView>
                <p:tab title="confirmDialog.xhtml">
                    <pre name="code" class="xml">
&lt;h:form&gt;

    &lt;p:growl id="messages" showDetail="true" /&gt;

    &lt;p:commandButton value="Destroy the World" actionListener="\#{buttonBean.destroyWorld}" update="messages"&gt;
        &lt;p:confirm header="Confirmation" message="Are you sure?" icon="ui-icon-alert" /&gt;
    &lt;/p:commandButton&gt;

    &lt;p:confirmDialog global="true" showEffect="fade" hideEffect="explode"&gt;
        &lt;p:commandButton value="Yes" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check"/&gt;
        &lt;p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close"/&gt; 	
    &lt;/p:confirmDialog&gt;

&lt;/h:form&gt;
                    </pre>
                </p:tab>

                <p:tab title="ButtonBean.java">
                    <pre name="code" class="java">
package org.primefaces.examples.view;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;

public class ButtonBean {

	public void destroyWorld(ActionEvent actionEvent){
		FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "System Error",  "Please try again later.");
		
		FacesContext.getCurrentInstance().addMessage(null, message);
	}
}
                    </pre>
                </p:tab>
            </p:tabView>
        </div>

    </ui:define>
</ui:composition>
